import 'package:flutter/material.dart';

class CustomOutlineButton extends StatelessWidget {
  final VoidCallback onPressed;
  final String text;
  final Color borderColor;
  final double borderRadius;
  final double borderWidth;
  final EdgeInsetsGeometry padding;
  final TextStyle? textStyle;
  final Color? backgroundColor;

  const CustomOutlineButton({
    super.key,
    required this.onPressed,
    required this.text,
    this.borderColor = Colors.purple,
    this.borderRadius = 8.0,
    this.borderWidth = 1.0,
    this.padding = const EdgeInsets.symmetric(vertical: 14, horizontal: 24),
    this.textStyle,
    this.backgroundColor,
  });

  @override
  Widget build(BuildContext context) {
    return OutlinedButton(
      onPressed: onPressed,
      style: OutlinedButton.styleFrom(
        padding: padding,
        side: BorderSide(color: borderColor, width: borderWidth),
        shape: RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(borderRadius),
        ),
        backgroundColor: backgroundColor,
      ),
      child: Text(text, style: textStyle ?? _defaultTextStyle(context)),
    );
  }

  TextStyle _defaultTextStyle(BuildContext context) {
    return TextStyle(
      fontSize: 16,
      color: borderColor,
      fontWeight: FontWeight.w500,
    );
  }
}
